// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db = cloud.database();
// 云函数入口函数
exports.main = async (event, context) => {
  let userInfo = event.userInfo;
  delete event.userInfo;
  console.log(event);
  try {
    if (Object.keys(event).length == 0) {
      return await db.collection("bills").where({
        userInfo:userInfo
      }).get();;
    } else {
      return await db.collection("bills").where({
        today:event.today,
        userInfo:userInfo
      }).get();
    }

  } catch (error) {
    
  }

}